package com.hunteron.jdbc.dao;

import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;

import com.hunteron.common4s.jdk.JunitConsoleOut;
import com.hunteron.jdbc.ConnectionHandler;
import com.hunteron.jdbc.dao.itf.IPositionHunterSortDao;

@Deprecated
public class PositionHunterSortDao implements IPositionHunterSortDao {

    @Override
    public Map<Long, Integer> getHunterSort(Long hunterId) {
        ConnectionHandler handler = null;
        Map<Long, Integer> result = new HashMap<Long, Integer>();
        try {

            handler = new ConnectionHandler("mldata");
            String sql = JunitConsoleOut.consoleLine("SELECT pos_ID, rank FROM pos_hh_match WHERE HH_ID = {};", new Object[]{
                    hunterId
            });

            ResultSet resultSet = handler.executeSql(sql);
            
            while(resultSet.next()) {
                result.put(resultSet.getLong(1), resultSet.getInt(2));
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (handler != null) {
                handler.close();
            }
        }
        return result;
    }

}
